package com.itc.bi.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itc.bi.entity.DataProcessEntity;
import com.itc.bi.mapper.DataProcessMapper;
import com.itc.bi.service.DataProcessService;
import com.itc.bi.service.PointerDictionaryService;
import com.itc.bi.vo.DirctProcessVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @BelongsProject: itc-airport-cloud
 * @BelongsPackage: com.itc.bi.service.impl
 * @Author: hecaiy
 * @CreateTime: 2024-07-16  15:02
 * @Description: TODO 指标字典接口服务层
 * @Version: 1.0
 */
@Service
public class PointerDictionaryServiceImpl implements PointerDictionaryService {

    @Autowired
    private DataProcessMapper dataProcessMapper;

    /**
     * 数据字典分页获取数据
     * @param dataSetName
     * @param processName
     * @param pageIndex
     * @param pageSize
     * @return
     */
    public IPage<DirctProcessVO> getDirctProcessPageData(String dataSetName, String processName,Integer pageIndex, Integer pageSize){
        pageIndex = pageIndex<1?1:pageIndex;
        pageSize = pageSize<1?10:pageSize;
        IPage<DirctProcessVO> page = new Page<DirctProcessVO>(pageIndex,pageSize);
        IPage<DirctProcessVO> dirctProcessPageData = dataProcessMapper.getDirctProcessPageData(page, dataSetName, processName);
        return dirctProcessPageData;
    }

    /**
     * 分页获取指标列表
     * @param dtId
     * @param pageIndex
     * @param pageSize
     * @return
     */
    public IPage<DataProcessEntity> getPageData(Long dtId,Integer pageIndex, Integer pageSize){
        pageIndex = pageIndex<1?1:pageIndex;
        pageSize = pageSize<1?10:pageSize;
        IPage<DataProcessEntity> page = new Page<DataProcessEntity>(pageIndex,pageSize);
        IPage<DataProcessEntity> pageData = dataProcessMapper.selectPage(page, Wrappers.<DataProcessEntity>lambdaQuery().eq(DataProcessEntity::getDtId,dtId));
        return pageData;
    }

}
